<jcpsm:pageContainer>
<c:if test="${not empty sessionScope.isUserLoggedIn && empty sessionScope.admin}">
	<jsp:forward page="/profile/home.jsp"></jsp:forward>
</c:if>
<c:if test="${empty sessionScope.isUserLoggedIn && empty sessionScope.admin}">
	<jsp:forward page="/index.jsp"></jsp:forward>
</c:if>
	<div class="content">
	<div class="">
	<h1 class="title">Manage <span>Shifts</span></h1>
	<c:if test="${not empty sessionScope.shift}">
	<table class="gridtable" border="1" style="box-shadow: 5px 5px 8px #888888;" width="100%">
		<tr align="center">
			<td class="heading fillgray">
				Name
			</td>
			<td class="heading fillgray">
				Description
			</td>
			<td class="heading fillgray">
				Comp Appl
			</td>
			<td class="heading fillgray">
				Shift Appl
			</td>
			<td width="5%" class="heading fillgray">
				&nbsp;
			</td>
			<td width="5%" class="heading fillgray">
				&nbsp;
			</td>
		</tr>
		<c:forEach var="shiftEntry" items="${sessionScope.shift}">
		<c:if test="${shiftEntry.value.deleteFlag == false}">
 	 		<tr align="center">
			<td class="heading">
				${shiftEntry.value.shiftName}
			</td>
			<td class="heading">
				${shiftEntry.value.shiftDescription}
			</td>
			<td class="heading">
				${shiftEntry.value.isCompOffApplicable}
			</td>
			<td class="heading">
				${shiftEntry.value.isScheduleApplicable}
			</td>
			<td width="5%">
				<c:if test="${(shiftEntry.value.shiftName ne 'Comp off') and (shiftEntry.value.shiftName ne 'Vacation')}">
					<a href="${contextRoot}/editShift?shiftId=${shiftEntry.value.shiftId}"><img src="${mediaRoot}/edit_icon.gif"/> </a>
				</c:if>
			</td>
			<td width="5%">
				<c:if test="${(shiftEntry.value.shiftName ne 'Comp off') and (shiftEntry.value.shiftName ne 'Vacation')}">
					<a href="${contextRoot}/deleteShift?shiftId=${shiftEntry.value.shiftId}"><img src="${mediaRoot}/delete_icon.gif"/></a>
				</c:if>
			</td>
		</tr>
 	 	</c:if>	
		</c:forEach>
	</table>
	</c:if>
<c:if test="${not empty sessionScope.shiftEditInfo}">
<s:form action="updateShift">
<table border="0" class="track_table" align="center" style="margin-left: 270px" >
<input name="shiftId" type="hidden" value="${sessionScope.shiftEditInfo.shiftId}"/>
		<tr>
			<td>
				Shift Name
			</td>
			<td>
				<s:textfield name="shiftName"  theme="simple" cssClass="syle_input width_200" value="%{#session.shiftEditInfo.shiftName}"/>
			</td>
		</tr>
		<tr>
			<td>
				Description
			</td>
			<td>
				<s:textarea name="shiftDescription" theme="simple" cssClass="syle_input width_200" value="%{#session.shiftEditInfo.shiftDescription}"/>
			</td>
		</tr>
		<tr>
		<td>Is Comp off Applicable?</td>
			<td style="height: 15px">
			<div class="dayIndex2" style="float: left">
				<input	name="isCompOffApplicable" id="dayIndex2" type="checkbox" <c:if test="${not empty sessionScope.shiftEditInfo.isCompOffApplicable}">checked="checked"</c:if> title="Comp off Applicable" value="Yes">
				<label for="dayIndex2" title="Comp off Applicable"></label>
				</div>
			</td>
				</tr>
				<tr>
				<td>Is Shift Applicable?</td>
			<td style="height: 15px">
			
			<div class="dayIndex5" style="float: left">
			<input name="isScheduleApplicable"
				type="checkbox" id="dayIndex5" <c:if test="${not empty sessionScope.shiftEditInfo.isScheduleApplicable}">checked="checked"</c:if> title="Shift Applicable" value="Yes"><label for="dayIndex5" title="Shift Applicable"></label>
				</div></td>
		</tr>
		<tr>
			<td>
				
			</td>
			<td>
			<a href="${contextRoot}/cancelShiftEdit" style="margin-top: 5px">Cancel</a>
				<s:submit cssClass="stylebutton mrgrgt80  mrgtp5" value="Update" theme="simple" cssStyle="float:right;"/>
			</td>
		</tr>
	</table>
</s:form>
</c:if>	
<c:if test="${empty sessionScope.shiftEditInfo}">
<s:form action="addShift">
	<table border="0" class="track_table" align="center" style="margin-left: 270px">
		<tr>
			<td>
				Shift Name
			</td>
			<td>
				<s:textfield name="shiftName"  theme="simple" cssClass="syle_input width_200" />
			</td>
		</tr>
		<tr>
			<td>
				Description
			</td>
			<td>
				<s:textarea name="shiftDescription" theme="simple" cssClass="syle_input width_200"/>
			</td>
		</tr>
		<tr>
		<td>Is Comp off Applicable?</td>
			<td style="height: 15px">
			<div class="dayIndex2" style="float: left">
				<input	name="isCompOffApplicable" id="dayIndex2" type="checkbox" title="Comp off Applicable" value="Yes">
				<label for="dayIndex2" title="Comp off Applicable"></label>
				</div>
			</td>
				</tr>
				<tr>
				<td>Is Shift Applicable?</td>
			<td style="height: 15px">
			
			<div class="dayIndex5" style="float: left">
			<input name="isScheduleApplicable"
				type="checkbox" id="dayIndex5" title="Shift Applicable" value="Yes"><label for="dayIndex5" title="Shift Applicable"></label>
				</div></td>
		</tr>
		<tr>
			<td colspan="2">
				<s:submit cssClass="stylebutton mrgrgt80 mrgtp5" value="Create" theme="simple" cssStyle="float:right;"/>
			</td>
		</tr>
	</table>
</s:form>
</c:if>
	</div>
	</div>
</jcpsm:pageContainer>